package net.comm.user.db;


import java.sql.ResultSet;
import java.sql.SQLException;


import net.comm.user.bean.BaseUserSysinfo;
import net.comm.util.StringUtil;

import org.sakaiproject.db.api.SqlReader;

public class DbUserSysinfoService implements SqlReader
{

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{
			
			int  	userID = result.getInt(1);			//	用户ID
			int  	integral = result.getInt(2);		//	用户积分
			int  	level = result.getInt(3);			//	用户等级
			double  amt = result.getDouble(4);			//	预存金额
			double  complete = result.getDouble(5);		//	资料完成百分比
			int  	attach = result.getInt(6);			//	人气指数
			int  	linjuNum = result.getInt(7);		//	邻居数量
			int  	firendNum = result.getInt(8);		//	好友数
			int  	blogNum = result.getInt(9);			//	日志数量
			int  	groupNum = result.getInt(10);		//	加入群组数
			int  	sendFoNum = result.getInt(11);		//	发贴数
			int  	repFoNum = result.getInt(12);		//	回帖数
			int  	partyNum = result.getInt(13);		//	参加活动次数
			int  	albumNum = result.getInt(14);		//	相册数量
			int  	picNum = result.getInt(15);			//	照片数量
			int  	nemailNum = result.getInt(16);		//新私信数
			int  	invitFrNum = result.getInt(17);		//好友请求数量
			int  	zhaohuNum = result.getInt(18);		//打招呼数量
			int  	liuyanNum = result.getInt(19);		//新留言数量
			int  	pinlunNum = result.getInt(20);		//新评论数量
			int  	huifuNum = result.getInt(21);		//新回复数量
			int  	jyqingNum = result.getInt(22);		//接受邀请数量
			int  	cysqNum = result.getInt(23);		//成员申请数量			
			long  	timestamp = result.getLong(24);		//	排名顺序（日期/时间）
			String 	mtime = StringUtil.getValue(result.getString(25));			//	最后修改时间	
			
			
			// create the Resource from these fields
			return new BaseUserSysinfo(  userID,  integral,  level, amt, complete,  attach,  linjuNum, 
					firendNum, blogNum,  groupNum,  sendFoNum, repFoNum,  partyNum,  albumNum,
					picNum,	nemailNum, invitFrNum, zhaohuNum,liuyanNum,pinlunNum, huifuNum,		
					jyqingNum,cysqNum, timestamp, mtime );
		}
		catch (SQLException e)
		{
			return null;
		}
		
	}
}
